from socket import *
import time

HOST='localhost'
PORT=21565
BUFSIZE=1024
ADDR=(HOST, PORT)

tcpCliSock=socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)

while True:
    print("sending a heartbeat")
    data = str.encode("recesive a heartbeat from client 1")
    tcpCliSock.send(data)
    data=tcpCliSock.recv(BUFSIZE)
    print(data)
    print ("wait for 5s ...")
    time.sleep(5)

tcpCliSock.close()
